
package view;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Calendar;
import java.util.GregorianCalendar;

import javax.swing.JLabel;


/**
 * 
 * @author Giuseppe Fusco (fusgius19@gmail.com)
 *
 */
public class DateJDialog extends javax.swing.JDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2437082110446471937L;
	private JLabel[][] lday;
	private int day;
	private GregorianCalendar gr;
	private final static int dom[] = { 31, 28, 31, 30,
		31, 30, 31, 31,
		30, 31, 30, 31 
	};
	
    /**
     * Creates new form DateJDialog
     */
    public DateJDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    public DateJDialog() {
		initComponents();
    	setModal(true);
		gr = (GregorianCalendar) GregorianCalendar.getInstance();
		day=gr.get(Calendar.DAY_OF_MONTH);
		hour.setText(String.valueOf(gr.get(Calendar.HOUR_OF_DAY)));
		minut.setText(String.valueOf(gr.get(Calendar.MINUTE)));
		lday = new JLabel[6][7];
		for(int i=0; i<6;i++)
			for(int j=0; j<7;j++){
				final JLabel l = new JLabel();
				l.setFont(new java.awt.Font("Trebuchet MS", Font.BOLD, 18));
				l.setHorizontalAlignment(JLabel.CENTER);
				lday[i][j]=l;
				l.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseClicked(MouseEvent arg0) {
						// TODO Auto-generated method stub
						for(int m=0; m<6;m++)
							for(int n=0;n<7;n++)
								lday[m][n].setForeground(Color.BLACK);
						l.setForeground(Color.RED);
						day=Integer.parseInt(l.getText().length()>0?l.getText():"0");
					}
				});
				panelDate.add(l);
			}
		paintCalendar();
		for(int m=0; m<6;m++)
			for(int n=0;n<7;n++)
				if(lday[m][n].getText().equalsIgnoreCase(String.valueOf(day)))
					lday[m][n].setForeground(Color.RED);
		addListener();
	}

	public DateJDialog(GregorianCalendar gr){
		initComponents();
    	setModal(true);
		this.gr = gr;
		day=gr.get(Calendar.DAY_OF_MONTH);
		hour.setText(String.valueOf(gr.get(Calendar.HOUR_OF_DAY)));
		minut.setText(String.valueOf(gr.get(Calendar.MINUTE)));
		lday = new JLabel[7][7];
		for(int i=0; i<6;i++)
			for(int j=0; j<7;j++){
				final JLabel l = new JLabel();
				l.setFont(new java.awt.Font("Trebuchet MS", Font.BOLD, 18));
				l.setHorizontalAlignment(JLabel.CENTER);
				lday[i][j]=l;
				l.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseClicked(MouseEvent arg0) {
						// TODO Auto-generated method stub
						for(int m=0; m<6;m++)
							for(int n=0;n<7;n++)
								lday[m][n].setForeground(Color.BLACK);
						l.setForeground(Color.RED);
						day=Integer.parseInt(l.getText());
					}
				});
				panelDate.add(l);
			}
		paintCalendar();
		for(int m=0; m<6;m++)
			for(int n=0;n<7;n++)
				if(lday[m][n].getText().equalsIgnoreCase(String.valueOf(day)))
					lday[m][n].setForeground(Color.RED);
		addListener();
	}

	private void addListener(){
		nextMonth.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				gr.roll(Calendar.MONTH, 1);
				if(gr.get(Calendar.MONTH)==0)
					gr.roll(Calendar.YEAR, 1);
				paintCalendar();
			}
		});

		previousMonth.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				gr.roll(Calendar.MONTH, -1);
				if(gr.get(Calendar.MONTH)==11)
					gr.roll(Calendar.YEAR, -1);
				paintCalendar();	
			}
		});

		nextYear.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				gr.roll(Calendar.YEAR, 1);
				paintCalendar();
			}
		});

		previousYear.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				gr.roll(Calendar.YEAR, -1);
				paintCalendar();
			}
		});

		salva.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated method stub
				gr.set(gr.get(Calendar.YEAR), gr.get(Calendar.MONTH), day, gr.get(Calendar.HOUR_OF_DAY), gr.get(Calendar.MINUTE));
				doLayout();
				dispose();
			}
		});
		
		nextHour.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				gr.roll(Calendar.HOUR_OF_DAY, 1);
				hour.setText(String.valueOf(gr.get(Calendar.HOUR_OF_DAY)));
			}
		});

		nextMinut.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				gr.roll(Calendar.MINUTE, 1);
				minut.setText(String.valueOf(gr.get(Calendar.MINUTE)));
			}
		});

		previousHour.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				gr.roll(Calendar.HOUR_OF_DAY, -1);
				hour.setText(String.valueOf(gr.get(Calendar.HOUR_OF_DAY)));
			}
		});

		previousMinut.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				gr.roll(Calendar.MINUTE, -1);
				minut.setText(String.valueOf(gr.get(Calendar.MINUTE)));
			}
		});
	}

	public GregorianCalendar getCalendar() {
		return gr;
	}

	private void cleraLabel(){
		for(int m=0; m<6;m++)
			for(int n=0;n<7;n++)
				lday[m][n].setText("");
	}

	private void paintCalendar(){
		cleraLabel();
		anno.setText(String.valueOf(gr.get(Calendar.YEAR)));
		mese.setText(getMonth(gr.get(Calendar.MONTH)));
		gr.set(gr.get(Calendar.YEAR), gr.get(Calendar.MONTH), 1);
		int d = alignDate(gr.get(Calendar.DAY_OF_WEEK));
		lday[0][d-1].setText(String.valueOf(gr.get(Calendar.DAY_OF_MONTH)));
		int idm = 0;
		for(int i=0; i<7; i++){
			for(int j=(i==0?d:0); j<7; j++){
				if(idm<dom[gr.get(Calendar.MONTH)]-1){
					gr.roll(Calendar.DAY_OF_MONTH, 1);
					lday[i][j].setText(String.valueOf(gr.get(Calendar.DAY_OF_MONTH)));
					idm++;
				}
			}
		}
	}

	private int alignDate(int field){
		if(field==1)return 7;
		return field-1;
	}


	private String getMonth(int field){
		switch (field) {
		case 0:
			return "Gennaio";
		case 1:
			return "Febbraio";
		case 2:
			return "Marzo";
		case 3:
			return "Aprile";
		case 4:
			return "Maggio";
		case 5:
			return "Giugno";
		case 6:
			return "Luglio";
		case 7:
			return "Agosto";
		case 8:
			return "Settembre";
		case 9:
			return "Ottobre";
		case 10:
			return "Novembre";
		case 11:
			return "Dicembre";
		default:
			return "";
		}
	}

    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        javax.swing.JPanel jPanel2 = new javax.swing.JPanel();
        javax.swing.JPanel jPanel3 = new javax.swing.JPanel();
        javax.swing.JLabel mese1 = new javax.swing.JLabel();
        javax.swing.JLabel mese2 = new javax.swing.JLabel();
        javax.swing.JLabel mese3 = new javax.swing.JLabel();
        javax.swing.JLabel mese4 = new javax.swing.JLabel();
        javax.swing.JLabel mese5 = new javax.swing.JLabel();
        javax.swing.JLabel mese6 = new javax.swing.JLabel();
        javax.swing.JLabel mese7 = new javax.swing.JLabel();
        panelDate = new javax.swing.JPanel();
        previousMonth = new javax.swing.JButton();
        previousYear = new javax.swing.JButton();
        nextMonth = new javax.swing.JButton();
        nextYear = new javax.swing.JButton();
        mese = new javax.swing.JLabel();
        anno = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        nextHour = new javax.swing.JButton();
        hour = new javax.swing.JLabel();
        previousHour = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        nextMinut = new javax.swing.JButton();
        minut = new javax.swing.JLabel();
        previousMinut = new javax.swing.JButton();
        salva = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), "Calendario", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Trebuchet MS", 1, 12))); // NOI18N

        jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jPanel3.setLayout(new java.awt.GridLayout(1, 7));

        mese1.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
        mese1.setForeground(new java.awt.Color(0, 0, 255));
        mese1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        mese1.setText("Lun");
        mese1.setAutoscrolls(true);
        jPanel3.add(mese1);

        mese2.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
        mese2.setForeground(new java.awt.Color(0, 0, 255));
        mese2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        mese2.setText("Mar");
        mese2.setAutoscrolls(true);
        jPanel3.add(mese2);

        mese3.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
        mese3.setForeground(new java.awt.Color(0, 0, 255));
        mese3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        mese3.setText("Mer");
        mese3.setAutoscrolls(true);
        jPanel3.add(mese3);

        mese4.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
        mese4.setForeground(new java.awt.Color(0, 0, 255));
        mese4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        mese4.setText("Gio");
        mese4.setAutoscrolls(true);
        jPanel3.add(mese4);

        mese5.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
        mese5.setForeground(new java.awt.Color(0, 0, 255));
        mese5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        mese5.setText("Ven");
        mese5.setAutoscrolls(true);
        jPanel3.add(mese5);

        mese6.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
        mese6.setForeground(new java.awt.Color(0, 0, 255));
        mese6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        mese6.setText("Sab");
        mese6.setAutoscrolls(true);
        jPanel3.add(mese6);

        mese7.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
        mese7.setForeground(new java.awt.Color(0, 0, 255));
        mese7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        mese7.setText("Dom");
        mese7.setAutoscrolls(true);
        jPanel3.add(mese7);

        panelDate.setLayout(new java.awt.GridLayout(6, 7));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
            .addComponent(panelDate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        previousMonth.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        previousMonth.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icon/edit-delete__.png"))); // NOI18N
        previousMonth.setAutoscrolls(true);
        previousMonth.setBorder(null);
        previousMonth.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        previousMonth.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        previousYear.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        previousYear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icon/edit-delete__.png"))); // NOI18N
        previousYear.setAutoscrolls(true);
        previousYear.setBorder(null);
        previousYear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        previousYear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        nextMonth.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        nextMonth.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icon/add__.png"))); // NOI18N
        nextMonth.setAutoscrolls(true);
        nextMonth.setBorder(null);
        nextMonth.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        nextMonth.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        nextYear.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        nextYear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icon/add__.png"))); // NOI18N
        nextYear.setAutoscrolls(true);
        nextYear.setBorder(null);
        nextYear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        nextYear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        mese.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        mese.setForeground(new java.awt.Color(255, 0, 0));
        mese.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        mese.setText("Settembre");
        mese.setAutoscrolls(true);

        anno.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        anno.setForeground(new java.awt.Color(255, 0, 0));
        anno.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        anno.setText("2013");
        anno.setAutoscrolls(true);

        jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));

        nextHour.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        nextHour.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icon/add__.png"))); // NOI18N
        nextHour.setAutoscrolls(true);
        nextHour.setBorder(null);
        nextHour.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        nextHour.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel4.add(nextHour);

        hour.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        hour.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        hour.setText("24");
        hour.setAutoscrolls(true);
        jPanel4.add(hour);

        previousHour.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        previousHour.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icon/edit-delete__.png"))); // NOI18N
        previousHour.setAutoscrolls(true);
        previousHour.setBorder(null);
        previousHour.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        previousHour.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel4.add(previousHour);

        jPanel5.setLayout(new javax.swing.BoxLayout(jPanel5, javax.swing.BoxLayout.Y_AXIS));

        nextMinut.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        nextMinut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icon/add__.png"))); // NOI18N
        nextMinut.setAutoscrolls(true);
        nextMinut.setBorder(null);
        nextMinut.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        nextMinut.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel5.add(nextMinut);

        minut.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        minut.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        minut.setText("59");
        minut.setAutoscrolls(true);
        jPanel5.add(minut);

        previousMinut.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        previousMinut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icon/edit-delete__.png"))); // NOI18N
        previousMinut.setAutoscrolls(true);
        previousMinut.setBorder(null);
        previousMinut.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        previousMinut.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel5.add(previousMinut);

        salva.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        salva.setText("Salva");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(previousYear)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(anno)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(nextYear)
                                .addGap(42, 42, 42)
                                .addComponent(previousMonth)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(mese, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(nextMonth)
                                .addGap(8, 8, 8))
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(salva)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(0, 5, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(1, 1, 1)
                        .addComponent(salva)
                        .addGap(69, 69, 69))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(anno)
                                .addComponent(nextYear))
                            .addComponent(mese, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(nextMonth, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(previousYear, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(previousMonth, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(29, Short.MAX_VALUE))
        );

        pack();
    }
    
    private javax.swing.JLabel anno;
    private javax.swing.JLabel hour;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JLabel mese;
    private javax.swing.JLabel minut;
    private javax.swing.JButton nextHour;
    private javax.swing.JButton nextMinut;
    private javax.swing.JButton nextMonth;
    private javax.swing.JButton nextYear;
    private javax.swing.JPanel panelDate;
    private javax.swing.JButton previousHour;
    private javax.swing.JButton previousMinut;
    private javax.swing.JButton previousMonth;
    private javax.swing.JButton previousYear;
    private javax.swing.JButton salva;
}
